extends Node2D

@export var tex:Texture2D
@export var hframes:int = 4
@export var height:float = 1

func render_sprites():
	for i in range(hframes):
		var sprite = Sprite2D.new()
		sprite.texture = tex
		sprite.hframes = hframes
		sprite.frame = i
		sprite.position.y += i * height
		add_child(sprite)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	GameSceneSystem.init_system()
	var fade_in_first_scene_options = GameSceneSystem.create_options(1, "fade")
	var first_scene_general_options = GameSceneSystem.create_general_options(Color(0, 0, 0), 1, false)
	GameSceneSystem.show_first_scene(fade_in_first_scene_options, first_scene_general_options)
	render_sprites()
	%B.tree_exited.connect(func():
		print(123))
	var arr = [2,3,1]
	arr.sort_custom(func(x,y):return x<y)
	print(arr[0])


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	#for child:Sprite2D in get_children():
		#child.rotation += delta
	if Input.is_action_just_pressed("ui_down"):
		var n = %B
		%A.remove_child(n)
		%C.add_child(n)
